package com.mstarc.app.mnfc.mstarcApiUtils;

import android.util.Log;

import mstarc_os_api.mstarc_os_api_msg;

/**
 * @author 崔健伟
 * @version V1.0
 * @Title: SelectUtil.java
 * @Package com.mstarc.app.mnfc.mstarcApiUtils
 * @Description:
 * @date 2017/6/27 09:43
 */
public class SelectUtil {
    private static final String TAG = "SelectUtil";

    public static boolean select(mstarc_os_api_msg m_api_msg) {
        int[] before_read_seid = new int[]{0x00, 0xA4, 0x04, 0x00, 0x00};
        int[] before_nfc = ApduUtil.apdu(m_api_msg, before_read_seid);
        Log.d(TAG, "select请求参数1:= " + BytetohexStringUtil.BytetohexString(before_read_seid));
        Log.d(TAG, "select返回值1:= " + BytetohexStringUtil.BytetohexString(before_nfc));
        if (before_nfc != null && before_nfc[0] == 0x6c) {
            before_read_seid[before_read_seid.length - 1] = before_nfc[before_nfc.length - 1];
            before_nfc = ApduUtil.apdu(m_api_msg, before_read_seid);
            Log.d(TAG, "select请求参数2:= " + BytetohexStringUtil.BytetohexString(before_read_seid));
            Log.d(TAG, "select返回值2:= " + BytetohexStringUtil.BytetohexString(before_nfc));
            return true;
        }
        return false;
    }
}
